package GUI.Frame;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TextFrameLayout {
    public static void main(String[] args) {
        Frame frame = new Frame("text");

        frame.setBounds(500,250,400,400);
        frame.setBackground(new Color(0x1CD951));
        frame.setVisible(true);
        frame.setLayout(new GridLayout(2,1));

        //四个面板
        Panel panel1 = new Panel(new BorderLayout());
        Panel panel2 = new Panel(new GridLayout(2,1));
        Panel panel3 = new Panel(new BorderLayout());
        Panel panel4 = new Panel(new GridLayout(2,2));

        panel1.add(new Button("text01"),BorderLayout.WEST);
        panel1.add(new Button("text02"),BorderLayout.EAST);

        panel2.add(new Button("text05"));
        panel2.add(new Button("text06"));

        panel1.add(panel2,BorderLayout.CENTER);

        panel3.add(new Button("text03"),BorderLayout.WEST);
        panel3.add(new Button("text04"),BorderLayout.EAST);

        panel4.add(new Button("text07"));
        panel4.add(new Button("text08"));
        panel4.add(new Button("text09"));
        panel4.add(new Button("text010"));

        panel3.add(panel4,BorderLayout.CENTER);

        frame.add(panel1);
        //frame.add(panel2);
        frame.add(panel3);
        //frame.add(panel4);

        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        frame.setVisible(true);
    }
}
